const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const Time = require('../public/javascripts/time')

const PingSchema = new Schema({
    bookid: {         //书id
        type: String,
        required: true
    },
    writerid: {     //作者id
        type: String,
        required: true
    },
    userid: {       //用户id
        type: String,
        required: true
    },
    username: {  //用户名字
        type: String,
        required: true
    },
    userava:{  //用户头像
        type: String,
        required: true
    },
    beforeid: {        //一级评论为0 子集评论为父评论id 回复未@+用户名+内容
        type: String,
        required: true
    },
    text: {       //评论内容
        type: String,
        required: true
    },
    state: {
        type: Number,
        default:1
    },
    date: {         //创建日期
        type: String,
        default: new Date()
    },
})

module.exports = Ping = mongoose.model("ping", PingSchema);